#
#   news.py
#   journalismManger
#
#   Created by luoxh on 2019/8/15 - 11:13.
#   Copyright © 2019 luoxh. All rights reserved.
#
from mongoengine import *

from src.model import BaseDocument


class NewsType(BaseDocument):
    name       = StringField(required=True, unique=True)


class News(BaseDocument):
    MEDIA_TYPE = (('normal', 1), ('content', 2), ('right', 3))
    title      = StringField(required=True)
    author     = StringField(required=True)
    images     = ListField(default=list())
    content    = StringField(default='')
    video_src  = StringField(default='')
    news_type  = ReferenceField(NewsType)
    media_type = StringField(choices=MEDIA_TYPE, required=True)
